//
//  NSNotificationCenter+extension.m
//  GK
//
//  Created by Seven on 2018/12/27.
//  Copyright © 2018 Seven. All rights reserved.
//

#import "NSNotificationCenter+extension.h"

NSString *const NotificationDidLogout = @"NotificationDidLogout";

NSString *const NotificationDidLogin = @"NotificationDidLogin";

NSString *const NotificationDidUpdateConfig = @"NotificationDidUpdateConfig";

NSString *const NotificationFetchConfigError = @"NotificationFetchConfigError";

NSString *const NotificationClosePlayerView = @"NotificationClosePlayerView";

NSString *const NotificationDidAddToBlacklist = @"NotificationDidAddToBlacklist";

NSString *const NotificationNetworkChanged = @"NotificationNetworkChanged";

NSString *const NotificationDidPublishVideo = @"NotificationDidPublishVideo";

NSString *const NotificationUpdateUserInfo = @"NotificationUpdateUserInfo";

@implementation NSNotificationCenter(extension)
+ (void)postName:(NSString *)name{
    custom_dispatch_after(0, ^{
        [[NSNotificationCenter defaultCenter] postNotificationName:name object:nil];
    });
    
}

+ (void)addObserver:(id)observer selector:(SEL)aSelector name:(nullable NSNotificationName)aName{
    [[NSNotificationCenter defaultCenter] addObserver:observer ?: self selector:aSelector name:aName object:nil];
}

+ (void)removeObserver:(id)observer{
    [[NSNotificationCenter defaultCenter] removeObserver:observer];
}

+ (void)removeObserver:(id)observer name:(nullable NSNotificationName)aName object:(nullable id)anObject{
    [[NSNotificationCenter defaultCenter] removeObserver:observer name:aName object:anObject];
}
@end
